package handler

import (
	"river-guard/moder"

	"github.com/gin-gonic/gin"
)

func UserLogin(c *gin.Context) {
	username := c.PostForm("username")
	password := c.PostForm("password")
	if username == "" || password == "" {
		c.JSON(200, gin.H{
			"mas":  "不能为空",
			"code": 500,
		})
		return
	}

	var user moder.User
	moder.DB.Where("username=?", username).Find(&user)
	c.JSON(200, gin.H{
		"mas":  "成功",
		"code": 200,
	})
	return

}
func List(c *gin.Context) {
	var user []moder.User
	moder.DB.Find(&user)
	c.JSON(200, gin.H{
		"mas":  "成功",
		"code": 200,
		"data": user,
	})
	return
}
